import myAxios from "@/util/request";

/**
 * 上传文件
 * @param file 要上传的文件
 * @returns Promise
 */
export const uploadFile = (file: File) => {
  const formData = new FormData();
  formData.append('file', file);
  
  return myAxios({
    url: '/file/upload',
    method: 'POST',
    headers: {
      'Authorization': localStorage.getItem('token'),
      'Content-Type': 'multipart/form-data'
    },
    data: formData
  });
}; 